package heima.lm.oschina.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import butterknife.BindView;
import butterknife.ButterKnife;
import heima.lm.oschina.BaseApplication;
import heima.lm.oschina.R;
import heima.lm.oschina.adapter.MessageVpAdapter;
import heima.lm.oschina.base.BaseActivity;
import heima.lm.oschina.utils.HttpUtils;

/**
 * Created by xiguoqiang on 2017/4/6.
 */

public class UserMessageCenterActivity extends BaseActivity {
    @BindView(R.id.user_msg_toolbar)
    Toolbar mToolbar;
    @BindView(R.id.tab_user_msg_center)
    TabLayout mTabLayout;
    @BindView(R.id.vp_user_msg_center)
    ViewPager mViewPager;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_usermessagecenter);
        //绑定了两个控件
        ButterKnife.bind(this);
        BaseApplication.mActivityList.add(this);
        init();
    }

    private void init() {
        mToolbar.setNavigationIcon(R.drawable.actionbar_back_icon_normal);
        mToolbar.setTitle("消息中心");
        setSupportActionBar(mToolbar);
        mViewPager.setAdapter(new MessageVpAdapter(getSupportFragmentManager()));
        mTabLayout.setupWithViewPager(mViewPager);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UserMessageCenterActivity.this.finish();
            }
        });
    }

}
